{extend name='layout:app'}

{block name='css'}
<link rel="stylesheet" href="__STATIC__/css/show-code.css">
{/block}

{block name='content'}
    <div id="app">
        <div class="nav">
            <i class="el-icon-arrow-left icon_left" @click="back"></i>
            <div>我的取件码</div>
            <i class="iconfont icon-home icon_right" @click="home"></i>
        </div>

        <div class="show-code">
            <div class="title">蜂鸟驿站取件码</div>
            <div class="tips-info">将二维码对准扫码口扫码进出站</div>
            <div style="margin: 10% 0;">
                <span>取货码：</span>
                {foreach $code as $item}
                <p style="margin: 3% 0;">{$item}</p>
                {/foreach}
            </div>
            <div class="code">
                <!--<img src="__STATIC__/imgs/QrCode.jpg" alt="">-->
                <img src="__IMG__/loading.gif">
            </div>
            <div class="lottery">
                <a href="/index/index/lottery.html">
                    <img src="__IMG__/lottery.png" alt="" style="width: 60%;">
                </a>
            </div>
            <!--<div class="share"><el-button type="primary" @click="shareCode">分享二维码</el-button></div>-->
        </div>
<!--        <div>-->
<!--            <p>取货码：</p>-->
<!--            {foreach $code as $item}-->
<!--            <p>{$item}</p>-->
<!--            {/foreach}-->
<!--        </div>-->
    </div>
{/block}

{block name='footer'}{/block}

{block name='js'}
<script>
    new Vue({
        el:'#app',
        data: {

        },
        mounted() {
            const codeNum = window.location.href.split('codeNum=')[1]
            $.get('/index/person/getqrcode',{orderNum:codeNum},function (res) {
                if(res.code === 0) {
                    $('.code img')[0].src = 'data:image/jpg;base64,'+res.data
                    $('.code img').css({width:'100%'})
                }
            })
            // var url = sessionStorage.getItem('codeUrl')
            // if(url) {
            //     $('.code img')[0].src = url
            //     $('.code img').css({width:'100%'})
            // }
        },
        methods: {
            back() {
                window.history.go(-1)
            },
            home() {
                location.href = '/'
            }
        }
    });

</script>
{/block}